import axios from "../util/axios";

export function addCart(params) {
  return axios.post("/shop-cart", params, {
    headers: {
      token: localStorage.getItem("token") || "",
    },
  });
}

export function modifyCart(params) {
  return axios.put("/shop-cart", params, {
    headers: {
      token: localStorage.getItem("token") || "",
    },
  });
}

export function getCart(params) {
  return axios.get("/shop-cart", {
    params,
    headers: {
      token: localStorage.getItem("token") || "",
    },
  });
}

export function deleteCartItem(id) {
  return axios.delete(`/shop-cart/${id}`, {
    headers: {
      token: localStorage.getItem("token") || "",
    },
  });
}

export function getByCartItemIds(params) {
  return axios.get("/shop-cart/settle", {
    params,
    headers: {
      token: localStorage.getItem("token") || "",
    },
  });
}
